package com.clf.springBoot.modules.test.dao;


import com.clf.springBoot.modules.test.entity.Student;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface StudentDao extends JpaRepository<Student,Integer> {

    List<Student> findByStudentName(String StudentName);
    @Modifying
    @Query(value = "update Student set studentName = :#{#student.studentName} " +
            "where id = :#{#student.id}")
    void updateStudent(@Param("student") Student student);
}
